package com.cloudpivot.receivales.excel.view;

import com.cloudpivot.receivales.ding.scenegroup.view.RspEnum;
import lombok.Getter;
import lombok.Setter;

/**
 * excel返回状态值
 */
public enum RspEnumForExcel {

    ONE(1, "成功转换"),
    TWO(-1, "sheet数量异常(可能Excel工作表为空)"),
    ThREE(-2, "模版顺序改变,或名称改变!"),
    FIVE(-3,"工作表内容为空"),
    SIX(-4,"表头不存在"),
    SEVEN(-5, "表头字段不正确(被修改过)"),
    EIGHT(-99,"请求报文异常"),
    NINE(-98,"获取excel异常"),
    ;

    @Getter
    @Setter
    private Integer k;
    @Getter
    @Setter
    private String v;

    RspEnumForExcel(Integer k, String v) {
        this.k = k;
        this.v = v;
    }

    /**
     * 根据k获取comment
     *
     * @param k
     * @return comment
     */
    public static String getValue(Integer k) {
        if (k==null) {
            return "转换异常";
        }
        for (RspEnumForExcel eNum : RspEnumForExcel.values()) {
            if (eNum.getK().equals(k)) {
                return eNum.getV();
            }
        }
        return "转换异常";
    }
}
